const Router = require('koa-router')

const {verifyAuth,verifyPermission} = require('../middleware/auth_middleware')
const {avatarHandle, pictureHandle, pictureResize} = require('../middleware/file_middleware')
const {saveAvatarInfo, savePictureInfo} = require('../controller/file_controller')

const fileRouter = new Router({prefix:'/upload'})

fileRouter.post('/avatar', verifyAuth, avatarHandle, saveAvatarInfo)
fileRouter.post('/picture', verifyAuth,verifyPermission('moment','true'), pictureHandle, pictureResize, savePictureInfo)

module.exports = fileRouter